import java.util.*;
import java.io.*;

/**
 * Write a description of class a17_2 here.
 * 
 * @author Amrita Mukherjee
 * @version 10/16/2012
 */
public class A17_2
{
   public static void main(String[] args) throws IOException
    {
        String name = "Amrita";
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());                    // today
        int year = cal.get(Calendar.YEAR);
        int month = 1 + cal.get(Calendar.MONTH);    // month starts at 0
        int day = cal.get(Calendar.DAY_OF_MONTH);
         System.out.println("@author " + name);
        System.out.println("@version " + year + " " + month + " " + day);
        
        Scanner keyboard = new Scanner(System.in);
        System.out.print(
            "This program will generate a new program (a class) for you.\n" +
            "Enter the new class name (ex. MyProgram): ");
 
        String klass = keyboard.nextLine();
 
       PrintWriter writer = new PrintWriter(new File(klass + ".Java"));
       
       writer.println("public class " + klass + " {");
       writer.println("    public static void main(String[] args) {");
       writer.println("        System.out.println(\"Hello world!\");");
       writer.println(" }");
       writer.println("}");
       
       writer.close();
       System.out.println("File written");
    }
}
/*
 * My test Session:
 * @author Amrita
@version 2012 10 16
This program will generate a new program (a class) for you.
Enter the new class name (ex. MyProgram): mm
File written

 */